<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:a="https://ajax4jsf.dev.java.net/ajax"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:ctg="http://www.crotouristguide.com/taglib"
	template="/templates/layout/columns_1.xhtml">

	<ui:define name="column1">
		<rich:panel styleClass="blue-panel">
			<s:div styleClass="title"><h1><h:outputText
				value="#{messages['title.add.review']}" /></h1>
			#{messages['subtitle.add.review']}</s:div>
			<s:decorate id="shortInfo">
				<f:subview rendered="#{dojamObjekt != null}">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{messages['label.zupanija']}:" />
						<h:outputText styleClass="txt"
							value="#{dojamObjekt.mjesto.zupanija.naziv}" />
						<h:outputLabel value="#{messages['label.otok']}:"
							rendered="#{! empty dojamObjekt.mjesto.otok}" />
						<h:outputText styleClass="txt"
							value="#{dojamObjekt.mjesto.otok.naziv}"
							rendered="#{! empty dojamObjekt.mjesto.otok}" />
						<h:outputLabel value="#{messages['label.posta']}:" />
						<h:outputText styleClass="txt"
							value="#{dojamObjekt.mjesto.posta.postanskiBroj} #{dojamObjekt.mjesto.posta.naziv}" />
						<h:outputLabel value="#{messages['label.mjesto']}:" />
						<h:outputText styleClass="txt" value="#{dojamObjekt.mjesto.naziv}" />
					</h:panelGrid>
				</f:subview>
				<f:subview rendered="#{dojamMjesto != null}">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{messages['label.zupanija']}:" />
						<h:outputText styleClass="txt"
							value="#{dojamMjesto.zupanija.naziv}" />
						<h:outputLabel value="#{messages['label.otok']}:"
							rendered="#{! empty dojamMjesto.otok}" />
						<h:outputText styleClass="txt" value="#{dojamMjesto.otok.naziv}"
							rendered="#{! empty dojamMjesto.otok}" />
						<h:outputLabel value="#{messages['label.posta']}:" />
						<h:outputText styleClass="txt"
							value="#{dojamMjesto.posta.postanskiBroj} #{dojamMesto.posta.naziv}" />
						<h:outputLabel value="#{messages['label.mjesto']}:" />
						<h:outputText styleClass="txt" value="#{dojamMjesto.naziv}" />
					</h:panelGrid>
				</f:subview>
				<f:subview rendered="#{dojamOtok != null}">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{messages['label.otok']}:" />
						<h:outputText styleClass="txt" value="#{dojamOtok.naziv}" />
					</h:panelGrid>
				</f:subview>
				<f:subview rendered="#{dojamPark != null}">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{messages['label.park']}:" />
						<h:outputText styleClass="txt" value="#{dojamPark.naziv}" />
					</h:panelGrid>
				</f:subview>
			</s:decorate>
			<h:form>
				<h:panelGrid columns="1" id="dojam" width="100%">
					<h:outputLabel for="rate" value="#{messages['label.rate']}" />
					<ctg:rate id="rate"
						value="#{dojamPosjetitelja.ocjena}" />

					<s:decorate id="titleDecoration" template="/templates/edit.xhtml">
						<ui:define name="label">#{messages['label.naslov']}</ui:define>
						<h:inputText value="#{dojamPosjetitelja.naslov}"
							styleClass="field f450" required="true">

						</h:inputText>
					</s:decorate>
					<s:decorate id="commentDecoration" template="/templates/edit.xhtml">
						<ui:define name="label">#{messages['label.tekst']}</ui:define>
						<h:inputTextarea value="#{dojamPosjetitelja.komentar}"
							styleClass="text f450" required="true">

						</h:inputTextarea>
					</s:decorate>
					<br />
					<h:panelGroup>

						<a:commandButton value="#{messages['label.submit']}"
							action="#{dojamAction.add}" reRender="dojam"  rendered="#{dojamPosjetitelja.idDpp == null}">
						</a:commandButton>
						<a:commandButton value="#{messages['label.submit']}"
							action="#{dojamAction.edit}" rendered="#{dojamPosjetitelja.idDpp != null}">
						</a:commandButton>
						<a:commandButton value="#{messages['label.delete']}" immediate="true"
							action="#{dojamAction.delete}" rendered="#{dojamPosjetitelja.idDpp != null}">
						</a:commandButton>						
						<h:commandButton action="#{dojamAction.back}"
							value="#{messages['label.cancel']}" immediate="true">
						</h:commandButton>
					</h:panelGroup>
				</h:panelGrid>
			</h:form>
		</rich:panel>
	</ui:define>
	<ui:define name="column2">
	
	</ui:define>
</ui:composition>